package com.microsoft;

import java.util.ArrayList;
import java.util.List;

import com.alibaba.fastjson.JSONArray;
import com.model.Data;

// // This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)
public class App
{
    public JSONArray process(long Id1, long Id2){  //type: Id-Id, Id-AuId, AuId-Id, AuId-AuId
        //请求数据并将两个id存储在datas0,1中
        Request request = new Request();
        //Data data;
        JSONArray result;
        //ArrayList result=new ArrayList();

        //判断类型
        String type = "AuId-AuId";
        List<Data> data1_list = request.request(Id1,"AA.AuId",1);
        if(data1_list.size() == 0){ //说明Id1的类型为Id
            Data data1 = request.request(Id1,"Id");
            List<Data> data2_list = request.request(Id2,"AA.AuId",1);
            if(data2_list.size() == 0){ //说明Id2的类型为Id
                Data data2 = request.request(Id2,"Id");
                type = "Id-Id";
                result = GetHop.getHop(data1,data2);
                //result.add(GetHop.getHop(data1,data2));
            }else { //Id2类型为AuId
                type = "Id-AuId";
                result = GetHop.getHop(data1,data2_list,Id2);
            }
        }else{  //Id1的类型为AuId
            List<Data> data2_list = request.request(Id2,"AA.AuId",1);
            if(data2_list.size() == 0) { //说明Id2的类型为Id
                Data data2 = request.request(Id2,"Id");
                type = "AuId-Id";
                result = GetHop.getHop(data1_list,data2,Id1);

            }else { //Id2类型为AuId
                type = "AuId-AuId";
                result = GetHop.getHop(data1_list,data2_list,Id1,Id2);
                //result.add(GetHop.GetHop3(Id1,Id2,1));*/
            }

        }
        System.out.print(type);
        return result;

    }

    public static void main(String[] args)
    {
        App pr1 = new App();
        JSONArray result;
        result = pr1.process(2155816549L,2207434427L);
        //result即为返回的字符串
        System.out.print(result.toString());
    }
}

